<template>
  <el-dialog
    title="编辑权限"
    :visible.sync="state"
    width="50%"
    :before-close="handleClose">
    <!-- dialog内容 -->
    <qf-form
      width="120px"
      :formConfig="formConfig"
      :formBtns="formBtns"
      @submit="submitFn">
    </qf-form>

    <!-- dialog内容 end -->
    <!-- <span slot="footer" class="dialog-footer">
      <el-button @click="handleClose">取 消</el-button>
      <el-button type="primary">确 定</el-button>
    </span> -->
  </el-dialog>
</template>

<script>
export default {
  props: {
    state: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      // 表单配置
      formConfig: [
        {
          label: '权限名称',
          field: 'auth_name',
          type: 'text',
          rules: [
            {
              required: true,
              message: '请输入权限名称',
              trigger: 'blur'
            }
          ]
        },
        {
          label: '权限访问路径',
          field: 'url',
          type: 'text',
          rules: [
            {
              required: true,
              message: '请输入权限访问路径',
              trigger: 'blur'
            }
          ]
        },
        {
          label: '权限组件路径',

          field: 'component',
          type: 'text',
          rules: [
            {
              required: true,
              message: '请输入权限组件路径',
              trigger: 'blur'
            }
          ]
        }
      ],
      formBtns: [
        {
          content: '更新',
          type: 'primary'
        },
        {
          content: '重置',
          type: ''
        }
      ]
    };
  },

  methods: {
    handleClose() {
      this.$emit('close');
    },
    submitFn(formData) {
      console.log('更新数据处理', formData);
    }
  }
};
</script>

<style></style>
